package calcmaster.calculator.domain;

import calcmaster.calculator.util.Maths;

public enum ConstantType {
	PI("pi", StrictMath.PI),
	PI12("pi12", Maths.PI12),
	PI32("pi32", Maths.PI32),
	PI2("pi2", Maths.PI2);
	
	private String constantName;
	private double constantValue;
	
	ConstantType(String constantName, double constantValue) {
		this.constantName = constantName;
		this.constantValue = constantValue;
	}
	
	public String getConstantName() {
		return this.constantName;
	}
	
	public double getConstantValue() {
		return this.constantValue;
	}
	
	public static ConstantType getFromName(String constantName) {
		for (ConstantType constantType : values()) {
			if (constantType.getConstantName().equals(constantName)) {
				return constantType;
			}
		}
		
		return null;
	}

}
